﻿CREATE PROCEDURE [dbo].[EditorPasswordSelect]
	@UserName nVarChar(50) = NULL,
	@EditorKey int = NULL

AS
	SET NOCOUNT ON

	IF (@UserName IS NULL AND @EditorKey IS NULL) OR (@UserName IS NOT NULL AND @EditorKey IS NOT NULL) BEGIN
		RAISERROR ('One of @UserName, @EditorKey must be non-null.', 15, 0)
		RETURN
	END

	SELECT PasswordSalt, PasswordHash 
	FROM Editor 
	WHERE 
		(@EditorKey IS NULL AND UserName = @UserName) OR
		(@UserName IS NULL AND EditorKey = @EditorKey)

RETURN 0
